<template>
	<div class="system-role-container layout-padding">
		<div class="system-role-padding layout-padding-auto">
			<el-card shadow="hover" class="pageQueryBoxArea mb10">
				<el-form :model="state.param" :inline="true">
					<el-form-item label="班次名称">
							<el-input v-model="state.param.keyword" placeholder="输入班次名称" clearable></el-input>
						</el-form-item>
					<el-form-item>
						<el-button type="primary" @click="search()">
							<el-icon>
								<ele-Search />
							</el-icon> 搜 索
						</el-button>
						<el-button type="primary" @click="addMember()">
							<el-icon>
								<ele-Plus />
							</el-icon> 新 增
						</el-button>
					</el-form-item>
				</el-form>
			</el-card>
			<el-card shadow="hover" style="display: flex;flex-direction: column;flex: 1;height: inherit;">
				<section style="display: flex;flex-direction: column; flex: 1;height: inherit;">
					<el-table :data="state.tableData" style="width: 100%"> 
						<el-table-column label="考勤组ID" prop="store" />
						<el-table-column label="考勤组名称" prop="name" />
						<el-table-column label="考勤组人数" prop="buyCount" />
						<el-table-column label="考勤类型" prop="orderPrice" /> 
						<el-table-column label="操作" width="160" align="center">
							<template #default="scope">
								<el-link :underline="false" type="primary" @click="oprationHandle(scope.row)">编辑</el-link>&emsp;
								<el-link :underline="false" type="danger" @click="deleteHandle(scope.row)">删除</el-link>
							</template>
						</el-table-column>
					</el-table>
					<el-row justify="end">
						<el-col :span="24" class="flex-end-center">
							<el-pagination @size-change="onHandleSizeChange" @current-change="onHandleCurrentChange" class="mt15"
								:pager-count="5" :page-sizes="[10, 20, 30]" v-model:current-page="state.param.pageNum" background
								v-model:page-size="state.param.pageSize" layout="total, sizes, prev, pager, next, jumper"
								:total="state.total">
							</el-pagination>
						</el-col>
					</el-row>
				</section>
			</el-card>
		</div>
		<OprationAtd :id="state.param.rowId" v-model="oprationVisble" :title="state.dialogTitle"  />
	</div>
</template>

<script setup lang="ts" name="funCountup">
import {  onMounted, reactive, ref } from 'vue'; 
import { ElMessageBox } from 'element-plus' 

import OprationAtd from '/@/views/personnel/attendanceSettings/components/OprationAtd.vue'  
 

const state = reactive({
	dialogTitle: '',
	param: {
		keyword: '',
		jobType: '',
		dateTime: '',
		total: 0, 
		pageNum: 1,
		pageSize: 10,
		rowId: 0,
	},
	query: { 
		jobTypeList: [
			{ value: 1, label: '全部' },
			{ value: 2, label: '总部' },
			{ value: 3, label: '门店' }
		], 
	},
	loading: false,
	total: 0,
	tableData: [
		{
			id: 1,
			name: 'Tom',
			property: '属性名称',
			spec: '规格',
			salesVolume: '销量',
			cellPrice: '销售价格', 
			orderPrice: '销售金额',
			buyCount: '购买人数',
			coverRatio: '客户覆盖率',
			performanceRatio: '业绩占比',
			allRatio: '全款率',
			startTime: '2023-12-22 12:36:54',
			endTime: '2023-12-22 12:36:54', 
			status: '活动状态',
		}
	] as Array<any>,
	userName: '', 
	type: 0	
});

const oprationVisble = ref(false)

const search = () => {}

const handleSizeChange = () => {}
const handleCurrentChange = () => {}

const deleteHandle = (row: any,) => {
	ElMessageBox.confirm(
		'确定删除吗 ?',
		'提示',
		{
			confirmButtonText: '确定',
			cancelButtonText: '删除',
			type: 'warning',
		}
	)
	.then(() => {
		
	})
	.catch(() => {
		
    })
}

const oprationHandle = (row: any,) => {
	state.dialogTitle = '编辑考勤组'
	state.param.rowId = row.id 
	oprationVisble.value = true 

}

const addMember = () => {
	state.dialogTitle = '新增考勤组'
	oprationVisble.value = true 
}

// 页面加载时
onMounted(() => {
});
</script>

<style scoped lang="scss">
@import '../../../theme/mixins/index.scss';
:deep(.el-card__body){
	display: flex;
	flex-direction: column;
	flex: 1;
	height: inherit;
	.el-table{
		flex: 1;
		.el-table__inner-wrapper::before{
			background: none !important;
		}
	}
}
</style>